// 1.引入封装好的axios
import axios from '@/utils/myaxios.js'

// 获取所有用户数据
export const getAllRole = () => {
  return axios({
    url: 'roles'
  })
}

// 删除角色指定权限
export const delRoleRight = (roleId, rightId) => {
  return axios({
    url: `roles/${roleId}/rights/${rightId}`,
    method: 'delete'
  })
}

// 为指定角色授权
export const addRightById = (roleId, rids) => {
  return axios({
    url: `roles/${roleId}/rights`,
    method: 'post',
    data: { rids }
  })
}

// 添加角色
export const addRole = (data) => {
  return axios({
    url: 'roles',
    method: 'post',
    data
  })
}
